package com.szqhyxj.youxiangju.biz.partnerHome.equipment;

import com.szqhyxj.youxiangju.biz.partnerHome.equipment.bean.SubordinateInfo;
import com.szqhyxj.youxiangju.biz.partnerHome.equipment.bean.StockBrand;
import com.szqhyxj.youxiangju.sys.BaseResult;
import com.szqhyxj.youxiangju.sys.RetrofitFacade;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

public class PartnerEquipmentModel{

    public interface PartnerEquipmentService {

        @POST("stockManage/inventInfo")
        Observable<BaseResult<StockBrand>> getStock();

        @FormUrlEncoded
        @POST("stockManage/deviceQuery")
        Observable<BaseResult<List<String>>> getStockList(@Field("brandId") String brandId);

        @FormUrlEncoded
        @POST("stockManage/outOrgan")
        Observable<BaseResult<List<SubordinateInfo>>> outOrgan(@Field("userName") String userName);

        @FormUrlEncoded
        @POST("stockManage/confirmOut")
        Observable<BaseResult<String>> confirmOut(@Field("devNo") String devNo
                ,@Field("toOrganId") int toOrganId);
    }


    /**
     * 获取设备型号列表
     * @param
     * @return
     */
    public static Observable<BaseResult<StockBrand>> getStock() {
        return RetrofitFacade.Companion.getRetrofit().create(PartnerEquipmentService.class).getStock();
    }

    /**
     * 获取某种设备存货列表
     * @param alias
     * @return
     */
    public static Observable<BaseResult<List<String>>> getStockList(String alias) {
        return RetrofitFacade.Companion.getRetrofit().create(PartnerEquipmentService.class).getStockList(alias);
    }

    /**
     * 获取未下发下级列表
     * @param
     * @return
     */
    public static Observable<BaseResult<List<SubordinateInfo>>> outOrgan(String userName) {
        return RetrofitFacade.Companion.getRetrofit().create(PartnerEquipmentService.class).outOrgan(userName);
    }

    /**
     *
     */
    public static Observable<BaseResult<String>> confirmOut(String devNo,int toOrganId) {
        return RetrofitFacade.Companion.getRetrofit().create(PartnerEquipmentService.class).confirmOut(devNo,toOrganId);
    }

}